<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>相对定位</title>
    <style>
        div{
            width: 200px;
            height: 200px;
        }
        .box1{
            background: red;
        }
        .box2{
            background: blue;
            position: relative;
            top: 20px;
            left: 30px;
        }
        .box3{
            background: yellow;
        }
    </style>
</head>
<body>
    <div class="box1"></div>
    <div class="box2"></div>
    <div class="box3"></div>
</body>
</html>